using DocumentMakingTools.ViewModels;

namespace DocumentMakingTools.Views;

public partial class SettingPage : ContentPage
{
	public SettingPage()
	{
		InitializeComponent();
		var vm = new SettingViewModel(this);
		vm.PropertyChanged += Vm_PropertyChanged;
		BindingContext = vm;

    }

	private void Vm_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
	{
		var vm = sender as SettingViewModel;

		App.AppSetting = new Models.SettingModel
		{
			DefaultOutputPath = vm.OutputDictionary,
			DefaultOpenCodeDocumentMode = vm.IsOpenCodeDocument
		};
	}
}